<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>PayChannel</title>
<link href="styles/general.css" rel="stylesheet" type="text/css" /><link href="styles/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/transport.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
     <script type="text/javascript" src="js/sorttable.js"></script>
    <script src="js/utils.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/jquery/uploadify/jquery.min.js"></script>

</head>

<body>
<h1>
        <!--<span class="action-span"><a href="channelpercent_show.do?msg=insert">添加配置</a></span>--> 
        <span class="action-span1"><a href="mainframe.jsp">首页</a></span>
        <span id="search_id" class="action-span1">- 渠道包配置管理 </span>
    </h1>
   <!-- start ad menu list -->
    <div class="list-div" id="listDiv">
        <table width="100%" cellspacing="1" cellpadding="2" class="sortable">
            <tbody>
                <tr>
                    <th>序号</th>
			        <th>渠道名称</th>
			        <th>渠道包名称</th>
			        <th>扣除比例</th>
			        <th></th>
                </tr>
                <s:if test="list.size()>0">
  				<s:iterator value="list" status="i">
  					 <tr>
                       <td style="background-color: rgb(255, 255, 255);"><s:property value="#i.count"/></td>
					   <td style="background-color: rgb(255, 255, 255);"><s:iterator value="channellist"><s:if test="id.equals(channelid)"><s:property value="name" /></s:if></s:iterator></td> 
					   <td style="background-color: rgb(255, 255, 255);"><s:property value="appname"/></td>
					   <td style="background-color: rgb(255, 255, 255);"><input id="scale_<s:property value="id"/>" size="10" value="<s:property value="scale"/>" />%</td>
					   <td style="background-color: rgb(255, 255, 255);"><input onclick='onscale(<s:property value="id"/>);' type="button" value="保存" /></td>
  					</tr>
  				</s:iterator>
  				</s:if>
  </tbody>
  </table>
  </div>
 <!--Bottom开始-->
    <script language="JavaScript">

if (document.getElementById("listDiv"))
{
  document.getElementById("listDiv").onmouseover = function(e)
  {
    obj = Utils.srcElement(e);

    if (obj)
    {
      if (obj.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode;
      else if (obj.parentNode.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode.parentNode;
      else return;

      for (i = 0; i < row.cells.length; i++)
      {
        if (row.cells[i].tagName != "TH") row.cells[i].style.backgroundColor = '#eeeded';
      }
    }

  };

  document.getElementById("listDiv").onmouseout = function(e)
  {
    obj = Utils.srcElement(e);

    if (obj)
    {
      if (obj.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode;
      else if (obj.parentNode.parentNode.tagName.toLowerCase() == "tr") row = obj.parentNode.parentNode;
      else return;

      for (i = 0; i < row.cells.length; i++)
      {
          if (row.cells[i].tagName != "TH") row.cells[i].style.backgroundColor = '#FFF';
      }
    }
  };

}

function onscale(id){
	var val = document.getElementById("scale_"+id);
	var reg = new RegExp("^[0-9]{1,2}$");  
	 if(!reg.test(val.value)){  
	     alert("扣除比例输入错误，请修正!"); 
	     val.style.borderColor="red";
	     return;
	 }else{
		 val.style.borderColor="";
	 }
	 $.get("appchannelapk_changescale.do?model.id="+id+"&model.scale="+val.value,function(data){
		 if(data.indexOf("ok")!=-1){
			 alert("扣除比例修改成功");
		 }else{
			 alert("相关比例修改失败，请稍后重试");
		 }
	 });
	 
}
    </script>
    
<div id="footer">
<br />
<s:property value="bottom"/></div>
    <!--Bottom结束-->
</body>
</html>